Re: Determine source module of inLink Aaron451 - Tue Apr 09 09:30:33 EDT 2019 PekkaMakinen - Mon Apr 08 23:45:12 EDT 2019
That example in the DXL Referenece has an error in it, it needs a pair of parentheses
Object o = current
string srcModName
for srcModName in each (o <-"*") do print srcModName "\n"
Generally you can get the source module of a link by using the "source" function:
Object o = current
LinkRef lref
ModName_ srcModRef
for lref in o<-"*" do {
srcModRef = source lref
read(fullName(srcModRef), true)
}
NICE!! Can't thank you enough. I've been dancing around this problem for years!
I added a couple comments and printing of module name to help me remember how to do this. For my particular use I just need to check the module name. I use it in a simple DXL filter. Why the link wizard doesn't give you the option to select a specific module to display I don't know (only a link module).
So to just get the module names of all inLinks:
Object o = current
string srcModName
for srcModName in each (o<-"*") do print srcModName "\n"
to open each module too:
// this finds, prints and opens the source module of any inLink to the current object
Object o = current
LinkRef lref
ModName_ srcModRef
for lref in o<-"*" do {
srcModRef = source lref
read(fullName(srcModRef), true)
print name srcModRef "\n"
// this line will give the full path starting at the project folder
// print fullName(srcModRef) "\n"
}
Ultimately what I wanted to do was modify an attribute DXL script do display only links from a specific module. Kink of ugly but it works:
// loop until we find the module name and do something (or NOT)
Object o = current
string srcModName
for srcModName in each (o<-"*") do {
if (srcModName == "<Name>") {
print srcModName "\n"
break
}
}
if (srcModName == "<Name>") {
print "Do some work here\n"
} else {
print "Do nothing\n"
}
|